// miniprogram/pages/course/detail/courseDetail/courseDetail.js
Page({

	/**
	 * 页面的初始数据
	 */
	data: {
		courseDetail: []
	},

	onLoad: function (options) {
		const eventChannel = this.getOpenerEventChannel()
		// 监听acceptDataFromOpenerPage事件，获取上一页面通过eventChannel传送到当前页面的数据
		eventChannel.on('sendData', (res) => {
			res.data.sliderImage = res.data.sliderImage.split(',');
			this.setData({
				courseDetail: res.data
			})
		})
	},
	onReady: function () {

	},
	onShow: function () {

	},
	onHide: function () {

	},
	onUnload: function () {

	},
	onPullDownRefresh: function () {

	},
	onReachBottom: function () {

	},
	onShareAppMessage: function () {

	},
	ClickPayBtn() {
		wx.navigateTo({
			url: '../courseToPay/courseToPay',
			success: (res) => {
				console.log("发送数据")
				res.eventChannel.emit('sendData', {
					data: this.data.courseDetail
				})
				console.log('跳转成功', res)
			},
			fail: err => {
				console.log(err, e.currentTarget.dataset.data)
			},
			complete: () => {}
		});
	}
})